<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:set var="webroot" value="${pageContext.request.contextPath}" />
<html lang="en">
<head>
<meta charset="utf-8">
<title>参数开关</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" href="${webroot}/static/layui/css/layui.css"
	media="all" />
<link rel="stylesheet" href="${webroot}/static/css/public.css"
	media="all" />
<style type="text/css">
.layui-btn+.layui-btn {
	margin-left: 0px;
}
.layui-form-label {
    width: 100px;
}
.layui-table td, .layui-table th {
    position: relative;
    padding: 9px 15px;
    min-height: 20px;
    line-height: 20px;
    font-size: 14px;
    text-align: center;
}
</style>
</head>
<body class="childrenBody">
	<form class="layui-form">
	<input type="hidden" id="id" name="id" value="${parame.id }">
	<div class="layui-form-item">
	    <label class="layui-form-label">参数开关</label>
	    <div class="layui-input-block" id="isStatus">
      	   <c:if test="${parame.paramValue == '1'}">
	       	    <input type="radio" name="paramValue" value="1" title="关闭" checked lay-filter="aaa">
	       	    <input type="radio" name="paramValue" value="0" title="打开" lay-filter="aaa">
	       </c:if>
	       <c:if test="${parame.paramValue == '0'}">
	       	    <input type="radio" name="paramValue" value="1" title="关闭" lay-filter="aaa">
	       	    <input type="radio" name="paramValue" value="0" title="打开" checked lay-filter="aaa">
	       </c:if>
	      </div>
	    </div>
   </div>
	</form>
	<script type="text/javascript" src="${webroot}/static/layui/layui.js"></script>
	<script type="text/javascript" src="${webroot}/static/js/jquery-3.2.1.min.js"></script>
	<script>
		layui.use([ 'form', 'layer', 'laydate', 'table', 'laytpl','upload'],function() {
				var form = layui.form, layer = parent.layer === undefined ? layui.layer
				: top.layer, $ = layui.jquery, laydate = layui.laydate, laytpl = layui.laytpl, table = layui.table;
				upload = layui.upload;
				
				//启用-禁用
				form.on('radio(aaa)', function (data) {  
				var index = layer.msg('修改中，请稍候', {
					icon : 16,
					time : false,
					shade : 0.8,
				});
				$.post("${webroot}/system/update", {
					id : $("#id").val(),
					paramValue : $('#isStatus input[name="paramValue"]:checked').val(),
				}, function(res) {
					 var data=JSON.parse(res);
					if (data.success) {
						layer.msg("操作成功");
						tableIns.reload();
					} else {
						top.layer.msg(data.message);
					}
					location.reload();
				})
			})

		})
	</script>
</body>
</html>